package br.com.sig.presentation.locale;
import java.io.Serializable;
import java.util.Locale;

import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Event;
import javax.inject.Inject;
import javax.inject.Named;

import org.jboss.seam.international.Alter;
import org.jboss.solder.core.Client;

@Named
@SessionScoped
public class LocaleAction implements Serializable {
	
	private static final long serialVersionUID = -5545907406613114100L;
	
	private Locale currentLocale = new Locale("pt", "BR");
	
	@Inject
	@Client
	@Alter
	private Event<Locale> localeEvent;

	public void englishLocale() {  
		currentLocale = Locale.US;
		localeEvent.fire(currentLocale);
	}

	public void portugueseLocale() {  
		currentLocale = new Locale("pt", "BR");
		localeEvent.fire(currentLocale);
	}

	public Locale getCurrentLocale() {
		localeEvent.fire(currentLocale);
		return currentLocale;  
	}  
}